home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
CBGRX100.ARJ
/
POLYTEST.C
< prev
next >
Wrap
Text File
|
1992-04-10
|
2KB
|
69 lines
/**
** POLYTEST.C
**
** Copyright (C) 1992, Csaba Biegl
** 820 Stirrup Dr, Nashville, TN, 37221
** csaba@vuse.vanderbilt.edu
**
** This file is distributed under the terms listed in the document
** "copying.cb", available from the author at the address above.
** A copy of "copying.cb" should accompany this file; if not, a copy
** should be available from where this file was obtained. This file
** may not be distributed without a verbatim copy of "copying.cb".
** You should also have received a copy of the GNU General Public
** License along with this program (it is in the file "copying");
** if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
** Cambridge, MA 02139, USA.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**/
#include "test.h"
#include <string.h>
static int red;
static void testpoly(int n,int points[][2])
{
GrClearScreen(GrBlack());
GrSetClipBox(100,100,700,500);
GrFilledPolygon(n,points,red);
GrSetClipBox(0,0,GrMaxX(),GrMaxY());
GrBox(99,99,701,501,GrWhite() | GrXOR);
GrPolygon(n,points,GrWhite() | GrXOR);
getkey();
}
TESTFUNC(ptest)
{
char buff[300];
int pts[300][2];
int ii,collect;
FILE *fp;
fp = fopen("polytest.dat","r");
if(fp == NULL) return;
collect = 0;
red = GrAllocColor(255,0,0);
GrSetColor((red ^ GrWhite()),0,50,255);
while(fgets(buff,299,fp) != NULL) {
if(!collect) {
if(strncmp(buff,"begin",5) == 0) {
collect = 1;
ii = 0;
}
continue;
}
if(strncmp(buff,"end",3) == 0) {
testpoly(ii,pts);
collect = 0;
continue;
}
if(sscanf(buff,"%d %d",&pts[ii][0],&pts[ii][1]) == 2) ii++;
}
}